package com.fmdj.snm.controller.form;

import lombok.Data;
import org.springframework.data.annotation.Id;
import org.springframework.data.mongodb.core.index.Indexed;
import org.springframework.data.mongodb.core.mapping.Document;

import java.io.Serializable;

@Data
@Document(collection = "message_ref")
public class MessageRefEntity implements Serializable {
    @Id
    private String _id;

    // 如果每条MQ消息都有唯一的UUID值，第一个消费者把消息保存到数据库
    //那么第二个消费者就无法再把这条消息保存到数据库，解决了消息的重复消费问题
    @Indexed(unique = true)
    private String messageId;

    @Indexed
    private Long receiverId;

    private String receiverIdentity;

    @Indexed
    private Boolean readFlag;

    @Indexed
    private Boolean lastFlag;
}
